import send_email6
import openpyxl
# 引入时间模块
import time

excel_file = openpyxl.load_workbook("names300.xlsx")
worksheet = excel_file.active
# 记录开始时间
start_time = time.time()
for index, row in enumerate(worksheet.rows):
    if index > 0:
        name = row[0].value
        email = row[3].value
        subfolder = int(index / 1000) + 1
        file_path = f'letters/{subfolder}/{name}.docx'
        print(f'正在给{name}发送邀请函...')
        send_email6.send_email(name, email, file_path)
        print(f'发送成功...')
        time.sleep(2)

# 记录结束时间
end_time = time.time()
# 记录和打印总时间
used_time = end_time - start_time
print(f'共用时{round(used_time, 0)}秒')
